<?php
$target_dir = "uploads/students/pics/";
$target_file = $target_dir .date("Ymd"). basename(iconv("utf-8","tis620",$_FILES["file-0"]["name"]));
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$type= strrchr($_FILES["file-0"]["name"],".");
// Check if image file is a actual image or fake image
if(($type==".jpg")||($type==".jpeg")||($type==".gif")||($type==".png")){
    $check = getimagesize($_FILES["file-0"]["tmp_name"]);
    if($check !== false) {
        echo date("Ymd").$_FILES["file-0"]["name"];
		@unlink($target_file);
		move_uploaded_file($_FILES["file-0"]["tmp_name"], $target_file);
        $uploadOk = 1;
    } else {
        echo "0";
        $uploadOk = 0;
    }
}else{echo "1";}
?>